package com.dykj.fireFighting.server.base.dev.service.impl;

import com.dykj.fireFighting.api.base.dev.entity.DevHisFiles;
import com.dykj.fireFighting.api.base.dev.entity.DevHisWater;
import com.dykj.fireFighting.api.base.dev.entity.DevHisWaterZc;
import com.dykj.fireFighting.api.base.dev.service.IDevHisWaterService;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.common.core.utils.UUIDUtils;
import com.dykj.fireFighting.server.base.dev.mapper.DevHisFilesMapper;
import com.dykj.fireFighting.server.base.dev.mapper.DevHisWaterMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.Arrays;
import java.util.List;

/**
 * 消防水系统设备运行记录
 *
 * @Author LIJIANJIE
 * @Date  2021-07-12 15:09:48
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class DevHisWaterServiceImpl extends BaseServiceImpl<DevHisWaterMapper, DevHisWater> implements IDevHisWaterService {

    @Autowired
    private DevHisFilesMapper devHisFilesMapper;

    @Override
    public int getWaterNum(String id) {
        return this.baseMapper.getWaterNum(id);
    }

    @Override
    public int getCurrentWaterNum(String id) {
        return this.baseMapper.getCurrentWaterNum(id);
    }

    @Override
    public int getUpWater(String s) {
        return this.baseMapper.getUpWater(s);
    }

    @Override
    public int getCenterWaterNum(List<String> ids,String beginTime, String endTime) {
        return this.baseMapper.getCenterWaterNum(ids,beginTime,endTime);
    }

    @Override
    public int getCenterCurrentWater(List<String> ids) {
        return this.baseMapper.getCenterCurrentWater(ids);
    }

    @Override
    public int getCenterUpWater(List<String> ids) {
        return this.baseMapper.getCenterUpWater(ids);
    }

    @Override
    public DevHisWater getWaterLimit(String relationId) {
        return this.baseMapper.getWaterLimit(relationId);
    }

    @Override
    public int getWaterByTime(String id, String beginTime, String endTime,String tableName) {
        return this.baseMapper.getWaterByTime(id,beginTime,endTime,tableName);
    }

    @Override
    public void updateWater(DevHisWaterZc devHisWaterZc,String tableName) {

        DevHisWater devHisWater = new DevHisWater();
        devHisWater.setId(devHisWaterZc.getId());
        devHisWater.setFuheTime(devHisWaterZc.getFuheTime());
        devHisWater.setFuhePerson(devHisWaterZc.getFuhePerson());
        devHisWater.setFuhePersonId(devHisWaterZc.getFuhePersonId());
        devHisWater.setFuheContent(devHisWaterZc.getFuheContent());
        devHisWater.setIsEffective(devHisWaterZc.getIsEffective());
        devHisWater.setImportPart(devHisWaterZc.getImportPart());
        devHisWater.setStatus("1");
        this.baseMapper.updateByIdTable(devHisWater,tableName);

    }


}
